Index: sys/ufs/ufs/ufs_readwrite.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ufs/Attic/ufs_readwrite.c,v
retrieving revision 1.65.2.14
retrieving revision 1.65.2.16
diff -u -r1.65.2.14 -r1.65.2.16
--- sys/ufs/ufs/ufs_readwrite.c	4 Apr 2003 22:21:29 -0000	1.65.2.14
+++ sys/ufs/ufs/ufs_readwrite.c	14 May 2004 23:36:20 -0000	1.65.2.16
@@ -532,6 +532,8 @@
 			bp->b_flags |= B_DIRECT;
 		if (ioflag & IO_NOWDRAIN)
 			bp->b_flags |= B_NOWDRAIN;
+		if ((ioflag & (IO_SYNC|IO_INVAL)) == (IO_SYNC|IO_INVAL))
+			bp->b_flags |= B_NOCACHE;
 
 		if (uio->uio_offset + xfersize > ip->i_size) {
 			ip->i_size = uio->uio_offset + xfersize;
Index: sys/vm/vm_map.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_map.c,v
retrieving revision 1.187.2.26
retrieving revision 1.187.2.30
diff -u -r1.187.2.26 -r1.187.2.30
--- sys/vm/vm_map.c	5 May 2004 19:28:23 -0000	1.187.2.26
+++ sys/vm/vm_map.c	25 May 2004 22:46:38 -0000	1.187.2.30
@@ -70,6 +70,8 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/sysctl.h>
 #include <sys/proc.h>
 #include <sys/vmmeter.h>
 #include <sys/mman.h>
@@ -149,6 +151,10 @@
 static void vm_map_split __P((vm_map_entry_t));
 static void vm_map_unclip_range __P((vm_map_t map, vm_map_entry_t start_entry, vm_offset_t start, vm_offset_t end, int flags));
 
+static int old_msync;
+SYSCTL_INT(_vm, OID_AUTO, old_msync, CTLFLAG_RW, &old_msync, 0,
+    "Use old (insecure) msync behavior");
+
 void
 vm_map_startup()
 {
@@ -2014,7 +2020,7 @@
 			vm_object_page_remove(object,
 			    OFF_TO_IDX(offset),
 			    OFF_TO_IDX(offset + size + PAGE_MASK),
-			    FALSE);
+			    old_msync ? FALSE : TRUE);
 			vm_object_deallocate(object);
 		}
 		start += size;
